<template>
	<view>
		<view class="page-body">
			<!-- <view class="page-section page-section-gap" style="text-align: center;">
				<audio style="text-align: left" :src="current.src" :poster="current.poster" :name="current.name"
					:author="current.author" :action="audioAction" controls></audio>
			</view> -->
			111
			<camera @scancode="scanCodeCallBack" mode="scanCode" resolution="high" style="width: 100%;height: 500rpx;"></camera>
			<button @click="tackPhoto">拍照</button>
			{{imgSrc}}
			<image mode="widthFix" v-if="imgSrc" :src="imgSrc"></image>
			<!-- <image mode="widthFix" :src="src"></image> -->
		</view>
		<button @click="doScanCode" type="primary">扫码</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgSrc: '',
				current: {
					poster: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png',
					name: '致爱丽丝',
					author: '暂无',
					src: 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3',
				},
				audioAction: {
					method: 'pause'
				}
			}
		},
		methods: {
			tackPhoto() {
				let ctx = uni.createCameraContext()
				ctx.takePhoto({
					success:(res) => {
						console.log(res)
						this.imgSrc = res.tempImagePath
					}
				})
			},
			scanCodeCallBack(res) {
				console.log(res)
			},
			doScanCode() {
				uni.scanCode({
					success:(res) => {
						console.log(res)
					}
				})
			}
			
		}
	}
</script>

<style>

</style>